package com.mdd.admin.validate.subject;

import com.mdd.admin.validate.BaseParam;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import lombok.Data;
import javax.validation.constraints.*;

/**
 * 专题专区参数
 * @author panweiliang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SubjectParam extends BaseParam {

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class, change.class})
    private Integer id;

    @NotNull(message = "name参数缺失", groups = {create.class, update.class})
    @NotEmpty(message = "名称不能为空", groups = {create.class, update.class})
    @Length(max = 32, message = "名称不能超出32个字符", groups = {create.class, update.class})
    private String name;

    @NotNull(message = "cover参数缺失", groups = {create.class, update.class})
    @NotEmpty(message = "封面不能为空", groups = {create.class, update.class})
//    @Length(max = 128, message = "封面不能超出128个字符", groups = {create.class, update.class})
    private String cover;

//    @NotNull(message = "image参数缺失", groups = {create.class, update.class})
//    @NotEmpty(message = "封面图片不能为空", groups = {create.class, update.class})
//    @Length(max = 128, message = "封面图片不能超出128个字符", groups = {create.class, update.class})
    private String image;

    @DecimalMin(value = "0", message = "排序值不能少于0", groups = {create.class, update.class})
    private Integer sort = 0;

    @NotNull(message = "status参数缺失", groups = {create.class, update.class, change.class})
    @IntegerContains(values = {0, 1}, message = "status参数值不在符合范围", groups = {create.class, update.class})
    private Integer status = 1;

}
